import os

# 读取文件中的id
with open('id_list.txt', 'r') as file:
    ids = file.read().splitlines()

directory_path = 'E:/data/palm_vein/SCUT-PV-V2/b2'
# 根据id删除指定目录下的文件
for f_id in ids:
    for i in range(9):
        file_path = f'{directory_path}/{f_id}_{i+1}.jpg'
        if os.path.exists(file_path):
            os.remove(file_path)
            print(f'Deleted {file_path}')